package com.tbit.uqbike.client.pojo;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;

/**
 * @Author: chen
 * @Description: 新用户赠送配置
 * @Date: 创建于 13:41 2020/6/5
 */
public class NewUserActivity {
    /**
     * 活动id
     */
    private Integer newuseractivityId;
    /**
     * 运营区域id
     */
    private Integer accountId;
    /**
     * 名称
     */
    private String name;
    /**
     * 赠送金额
     */
    private Integer giveMoney;
    /**
     * 优惠券id
     */
    private Integer couponId;
    /**
     * 优惠券数量
     */
    private Integer couponCount;
    /**
     * 有效天数
     */
    private Integer validDays;
    /**
     * 备注
     */
    private String remark;
    /**
     * 优惠券名称
     */
    private String couponName;
    /**
     * 代理名称
     */
    private String accountName;
    /**
     * 开始时间
     */
    private String startTime;
    /**
     * 结束时间
     */
    private String endTime;

    public Integer getNewuseractivityId() {
        return newuseractivityId;
    }

    public void setNewuseractivityId(Integer newuseractivityId) {
        this.newuseractivityId = newuseractivityId;
    }

    public Integer getAccountId() {
        return accountId;
    }

    public void setAccountId(Integer accountId) {
        this.accountId = accountId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getGiveMoney() {
        return giveMoney;
    }

    public void setGiveMoney(Integer giveMoney) {
        this.giveMoney = giveMoney;
    }

    public Integer getCouponId() {
        return couponId;
    }

    public void setCouponId(Integer couponId) {
        this.couponId = couponId;
    }

    public Integer getCouponCount() {
        return couponCount;
    }

    public void setCouponCount(Integer couponCount) {
        this.couponCount = couponCount;
    }

    public Integer getValidDays() {
        return validDays;
    }

    public void setValidDays(Integer validDays) {
        this.validDays = validDays;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getCouponName() {
        return couponName;
    }

    public void setCouponName(String couponName) {
        this.couponName = couponName;
    }

    public String getAccountName() {
        return accountName;
    }

    public void setAccountName(String accountName) {
        this.accountName = accountName;
    }

    public String getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    public boolean valid() {
        if (Objects.isNull(this.startTime) && Objects.isNull(this.endTime)){
            return true;
        }
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime startTime = LocalDateTime.parse(this.startTime, formatter);
        LocalDateTime endTime = LocalDateTime.parse(this.endTime, formatter);
        LocalDateTime now = LocalDateTime.now();
        return now.isAfter(startTime) && now.isBefore(endTime);
    }

}
